package jin.si.controller;

import jin.si.util.JsonData;
import jin.si.util.RandomUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:VerificationCode
 * Package:jin.si.controller
 * Description: 手机验证码
 *
 * @Date:2022/3/7 上午 10:49
 * @Author: WYH
 */
@RestController
@RequestMapping("/personal")
public class VerificationCode {
    
    /**
     * @Author WYH
     * @Description //TODO 给手机发送验证码
     * @Date 上午 10:50 2022/3/7
     * @Param phone
     * @return  JsonDate
     **/
    @PostMapping("/sendCode")
    public JsonData sendCode(String phone){
        System.err.println(phone);
        String code = RandomUtil.randomCode();
        return code!=null? JsonData.buildSuccess(code): JsonData.buildError("服务器错误");
    }
}
